﻿using ArithCollect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Test.Scenes {
    public partial class AstarTest1 : UserControl {
        public AstarTest1() {
            InitializeComponent();
            var map = new byte[10, 10] {   
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  //0
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  //1
                { 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 },  //2
                { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },  //3
                { 2, 0, 0, 0, 1, 0, 0, 0, 0, 0 },  //4
                { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },  //5
                { 0, 0, 0, 0, 1, 0, 0, 0, 0, 2 },  //6
                { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },  //7
                { 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 },  //8
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }   //9             
            };
            var x = new List<byte>();
            var start = Tople.C<int, int>(4, 0);
            var end = Tople.C<int, int>(6, 9);
            var x2 = Astar.Create(map).Search(start, end, 1);
            foreach (var item in x2) {
                map[item.Item1, item.Item2] = 3;
            }
            map[start.Item1, start.Item2] = 2;
            map[end.Item1, end.Item2] = 2;
            foreach (var item in map) {
                x.Add(item);
            }
            lb.ItemsSource = x;
        }

    }
}
